/*
 * Copyright [2022] [https://www.xiaonuo.vip]
 *
 * Snowy采用APACHE LICENSE 2.0开源协议，您在使用过程中，需要注意以下几点：
 *
 * 1.请不要删除和修改根目录下的LICENSE文件。
 * 2.请不要删除和修改Snowy源码头部的版权声明。
 * 3.本项目代码可免费商业使用，商业使用请保留源码和相关描述文件的项目出处，作者声明等。
 * 4.分发源码时候，请注明软件出处 https://www.xiaonuo.vip
 * 5.不可二次分发开源参与同类竞品，如有想法可联系团队xiaonuobase@qq.com商议合作。
 * 6.若您的项目无法满足以上几点，需要更多功能代码，获取Snowy商业授权许可，请在官网购买授权，地址为 https://www.xiaonuo.vip
 */
package vip.xiaonuo.biz.modular.wall_category.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.mybatisflex.core.paginate.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.noear.solon.annotation.*;
import org.noear.solon.validation.annotation.NotEmpty;
import org.noear.solon.validation.annotation.Valid;
import org.noear.solon.validation.annotation.Validated;
import vip.xiaonuo.biz.model.common.SelectResult;
import vip.xiaonuo.biz.modular.wall_category.entity.BizWallCategory;
import vip.xiaonuo.biz.modular.wall_category.param.BizWallCategoryAddParam;
import vip.xiaonuo.biz.modular.wall_category.param.BizWallCategoryEditParam;
import vip.xiaonuo.biz.modular.wall_category.param.BizWallCategoryIdParam;
import vip.xiaonuo.biz.modular.wall_category.param.BizWallCategoryPageParam;
import vip.xiaonuo.biz.modular.wall_category.service.BizWallCategoryService;
import vip.xiaonuo.common.annotation.CommonLog;
import vip.xiaonuo.common.pojo.CommonResult;

import java.util.List;

/**
 * 壁纸分类控制器
 *
 * @author KingTiger
 * @date 2025/05/27 16:08
 */
@Api(tags = "壁纸分类控制器")
@Controller
@Valid
public class BizWallCategoryController {

    @Inject
    private BizWallCategoryService bizWallCategoryService;

    /**
     * 获取壁纸分类分页
     *
     * @author KingTiger
     * @date 2025/05/27 16:08
     */
    @ApiOperation("获取壁纸分类分页")
    @SaCheckPermission("/biz/wall_category/page")
    @Get
@Mapping("/biz/wall_category/page")
    public CommonResult<Page<BizWallCategory>> page(BizWallCategoryPageParam bizWallCategoryPageParam) {
        return CommonResult.data(bizWallCategoryService.page(bizWallCategoryPageParam));
    }

    /**
     * 添加壁纸分类
     *
     * @author KingTiger
     * @date 2025/05/27 16:08
     */
    @ApiOperation("添加壁纸分类")
    @CommonLog("添加壁纸分类")
    @SaCheckPermission("/biz/wall_category/add")
    @Post
@Mapping("/biz/wall_category/add")
    public CommonResult<String> add(@Body @Validated BizWallCategoryAddParam bizWallCategoryAddParam) {
        bizWallCategoryService.add(bizWallCategoryAddParam);
        return CommonResult.ok();
    }

    /**
     * 编辑壁纸分类
     *
     * @author KingTiger
     * @date 2025/05/27 16:08
     */
    @ApiOperation("编辑壁纸分类")
    @CommonLog("编辑壁纸分类")
    @SaCheckPermission("/biz/wall_category/edit")
    @Post
@Mapping("/biz/wall_category/edit")
    public CommonResult<String> edit(@Body @Validated BizWallCategoryEditParam bizWallCategoryEditParam) {
        bizWallCategoryService.edit(bizWallCategoryEditParam);
        return CommonResult.ok();
    }

    /**
     * 删除壁纸分类
     *
     * @author KingTiger
     * @date 2025/05/27 16:08
     */
    @ApiOperation("删除壁纸分类")
    @CommonLog("删除壁纸分类")
    @SaCheckPermission("/biz/wall_category/delete")
    @Post
@Mapping("/biz/wall_category/delete")
    public CommonResult<String> delete(@Body @Validated @NotEmpty(message = "集合不能为空")
                                       List<BizWallCategoryIdParam> bizWallCategoryIdParamList) {
        bizWallCategoryService.delete(bizWallCategoryIdParamList);
        return CommonResult.ok();
    }

    /**
     * 获取壁纸分类详情
     *
     * @author KingTiger
     * @date 2025/05/27 16:08
     */
    @ApiOperation("获取壁纸分类详情")
    @SaCheckPermission("/biz/wall_category/detail")
    @Get
@Mapping("/biz/wall_category/detail")
    public CommonResult<BizWallCategory> detail(@Validated BizWallCategoryIdParam bizWallCategoryIdParam) {
        return CommonResult.data(bizWallCategoryService.detail(bizWallCategoryIdParam));
    }

    /**
     * 获取壁纸分类列表(sel)
     *
     * @author KingTiger
     * @date 2025/05/27 16:08
     */
    @ApiOperation("获取壁纸分类列表(sel)")
    @SaCheckPermission("/biz/wall_category/getAllSelList")
    @Get
@Mapping("/biz/wall_category/getAllSelList")
    public CommonResult<List<SelectResult>> getAllSelList() {
        return CommonResult.data(bizWallCategoryService.getAllSelList());
    }
}
